-
-
Notifications
You must be signed in to change notification settings - Fork 33k
gh-137838: Move _PyUOpInstruction buffer to PyInterpreterState #138918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…to _PyThreadStateImpl
Include/internal/pycore_tstate.h
Outdated
* uint16_t jump_target; | ||
* uint16_t error_target; | ||
*/ | ||
typedef struct _PyUOpInstruction{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Fidget-Spinner I move _PyUOpInstruction to here becasue of declaration issue. But we may need to move this struct for better place.
I plan to add a new CI for nopt JIT with a separate PR. |
And I fully checked that |
Misc/NEWS.d/next/Core_and_Builtins/2025-09-15-13-14-20.gh-issue-137838.Ju-vRW.rst
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but just come over and ask Mark if he's okay with the struct being in pycore_optimizer.h
.
Now it's currently located in |
Woops yes that's the one I was thinking of. Thanks. |
Do you feel comfortable if I define |
That works too. |
This reverts commit ab39a55.
This reverts commit 877f3a9.
When I move to interpreter state, those tests are failed and could be race condition in some where, need to investgate with Windows machine. |
I still need to debug this in detail, but the buffer causes problems when it’s shared at the interpreter level under an asyncio workload. A per-thread approach also seems safe for the GIL build. |
|
Okay it turn out that it is not related to this change but looks like trigger other bug in asyncio. Let me test.. |
This reverts commit 989fa8e.
@brandtbucher @Fidget-Spinner Fixed! Ready to be merged! |
struct _stoptheworld_state stoptheworld; | ||
struct _qsbr_shared qsbr; | ||
|
||
struct _PyUOpInstruction *jit_uop_buffer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue was that I declared this field only for the TIER2 build.
We might need to adjust it properly if we want to exclude non-JIT builds.
But since the field is only allocated when the TIER2 build is enabled, I think it’s fine to leave it as is.
Thanks for doing this. I have a few comments:
#define UOP_MAX_TRACE_LENGTH JIT_TRACE_BUFFER_SIZE/sizeof(_PyUOpInstruction)
|
#ifdef _Py_TIER2 | ||
_Py_ClearExecutorDeletionList(interp); | ||
if (interp->jit_uop_buffer != NULL) { | ||
_PyObject_VirtualFree(interp->jit_uop_buffer, UOP_BUFFER_SIZE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brandtbucher _PyObject_VirtualFree doesn’t return a value, and the current CPython codebase doesn’t check whether it succeeds or not
@markshannon Hopefully you will like the current change :) I 've applied most of the changes you requested! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now.
Thanks
Uh oh!
There was an error while loading. Please reload this page.